package com.dengdai.apputils.activitys;

import android.view.View;
import android.widget.TextView;

import com.dengdai.applibrary.activitys.BaseActivity;
import com.dengdai.applibrary.interfaces.EditDialogInterface;
import com.dengdai.applibrary.interfaces.PromptDialogInterface;
import com.dengdai.applibrary.utils.LogUtils;
import com.dengdai.applibrary.utils.ToastUtils;
import com.dengdai.applibrary.widgets.dialog.ShowEditDialog;
import com.dengdai.applibrary.widgets.dialog.ShowPromptDialog;
import com.dengdai.apputils.R;
import com.dengdai.apputils.fragments.TextScrollViewFragment;
import com.dengdai.videoplay.VideoPlayerUtilsSimple;

import java.util.HashMap;
import java.util.Map;

import butterknife.Bind;
import butterknife.OnClick;

public class MainActivity extends BaseActivity {
    @Bind(R.id.tvName)
    public TextView tvName;
    @Bind(R.id.testWebView)
    public TextView testWebView;
    @Bind(R.id.testGridView)
    public TextView testGridView;
    @Bind(R.id.testShowDialog)
    public TextView testShowDialog;
    @Bind(R.id.testShowEditDialog)
    public TextView testShowEditDialog;
    @Bind(R.id.testExpandableList)
    public TextView testExpandableList;
    @Bind(R.id.testScrollView)
    public TextView testScrollView;
    @Bind(R.id.testTopIndicator)
    public TextView testTopIndicator;
    @Bind(R.id.testRxJava)
    public TextView testRxJava;
    private VideoPlayerUtilsSimple videoPlay;

    @Override
    public int getLayoutResID() {
        return R.layout.activity_main;
    }

    @Override
    public void initData() {

    }

    @Override
    public void business() {
        Map<String, String> headData = new HashMap<>();
        headData.put("key1", "value1");
        headData.put("key2", "value2");
        videoPlay = (VideoPlayerUtilsSimple) findViewById(R.id.videoPlay);
        videoPlay.setUp("http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4", headData);
    }


    @OnClick({R.id.tvName, R.id.testWebView, R.id.testGridView, R.id.testShowDialog, R.id.testShowEditDialog, R.id.testExpandableList, R.id.testScrollView, R.id.testTopIndicator,R.id.testRxJava})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tvName:
                getOperation().forward(TextListActivity.class, ANIMATION_LEFT_RIGHT);
                break;
            case R.id.testWebView:
                getOperation().forward(TestWebViewActivity.class, ANIMATION_LEFT_RIGHT);
                break;
            case R.id.testGridView:
                getOperation().forward(TestGridViewActivity.class, ANIMATION_LEFT_RIGHT);
                break;
            case R.id.testShowDialog:
                ShowPromptDialog showPromptDialog = new ShowPromptDialog(MainActivity.this);
                showPromptDialog.showPrompt("测试", "我是测试的内容", "取消", "确定", new PromptDialogInterface() {
                    @Override
                    public void determineClickInterface() {
                        ToastUtils.showToast("=====>>>>>>");
                    }
                }, false);
                break;
            case R.id.testShowEditDialog:
                ShowEditDialog showEditDialog = new ShowEditDialog(MainActivity.this);
                showEditDialog.showEdit("测试标题", null, "取消", "确定", new EditDialogInterface() {
                    @Override
                    public void determineContentNullHint() {
                        ToastUtils.showToast("请输入内容");
                    }

                    @Override
                    public void determineClickInterface(String str) {
                        LogUtils.i("===>>>" + str);
                    }
                }, false);

                break;
            case R.id.testExpandableList:
                getOperation().forward(TestExpandableListActivity.class, ANIMATION_LEFT_RIGHT);
                break;
            case R.id.testScrollView:
                getOperation().forward(TextScrollViewActivity.class, ANIMATION_LEFT_RIGHT);
                break;
            case R.id.testTopIndicator:
                getOperation().forward(TestTopIndicatorActivity.class, ANIMATION_LEFT_RIGHT);
                break;
            case R.id.testRxJava:
                getOperation().forward(TestRxJavaActivity.class, ANIMATION_LEFT_RIGHT);
                break;
        }
    }


}
